package com.sky.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import com.sky.mapper.OrdersMapper;
import com.sky.result.PageResult;
import com.sky.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 邓必宏
 * @title:
 * @Demo:
 * @DateTime: 2024/2/13
 */
@Service
public class OrdersServiceImpl implements OrdersService {

    @Autowired
    OrdersMapper ordersMapper;

    @Override
    public PageResult getOrdersBy(OrdersPageQueryDTO ordersPageQueryDTO) {
        PageHelper.startPage ( ordersPageQueryDTO.getPage ( ), ordersPageQueryDTO.getPageSize ( ) );
        Page<Orders> page = ordersMapper.queryOrdersByStatus ( ordersPageQueryDTO );
        return new PageResult ( page.getTotal ( ), page.getResult ( ) );
    }
}
